package app

import controller.EnglishLevelAnalysisController
import org.apache.spark.SparkConf
import org.apache.spark.sql.SparkSession
import util.SparkUtil
import org.apache.spark.streaming.Seconds

object EnglishLevelAnalysisEntryApp {
  def main(args: Array[String]): Unit = {
    // 初始化SparkSession
    val sparkConf = new SparkConf()
      .setAppName("EnglishLevelAnalysis")
      .setMaster("local[*]")
    SparkUtil.CreateSpark(sparkConf, Seconds(5))
    val spark = SparkUtil.takeSpark()

    try {
      // 使用绝对路径指定CSV文件位置
      val csvPath = "input/Chinese_resume_data.csv"
      
      val controller = new EnglishLevelAnalysisController(spark)
      controller.dispatch(csvPath)
    } finally {
      if (spark != null) spark.stop()
    }
  }
}